<template>
  <div>
      <h3>注册页面</h3>
      <p>用&ensp;户&ensp;名：<input type="text" v-model="username"></p>
      <p>密&emsp;&emsp;码：<input type="text" v-model="password1"></p>
      <p>确认密码：<input type="text" v-model="password2"></p>
      <p><button @click="register">注册</button></p>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            username:'',
            password1:'',
            password2:'',
            base_url:'http://127.0.0.1:8000',
        }
    },
    methods: {
        register() {
            let fdata=new FormData()
            fdata.append('username',this.username)
            fdata.append('password1',this.password1)
            fdata.append('password2',this.password2)
            axios({
                url:this.base_url + '/app01/register/',
                method:'post',
                data:fdata
            }).then(resp=>{
                console.log(resp.data)  
            })
            console.log(this.username,this.password1,this.password2) 
        }
    }
}
</script>

<style>

</style>